home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / x11 / strategy / xshisen-.001 / xshisen-~ / xshisen-1.35 / body.h < prev    next >
C/C++ Source or Header  |  1996-01-22  |  4KB  |  142 lines

  1. #include "components.h"
  2.  
  3. #define CLASS_NAME "XShisen"
  4. #define MIN_WIN_WID 320
  5. #define MIN_WIN_HEI 200
  6. #define NUM_GAME      3      // Number of game variation (size)
  7. #define XMARGIN       1      // Horizontal dots between pieces
  8. #define YMARGIN       1      // Vertical dots between pieces
  9. #define MESSAGE_SYMBOL  ((Pixmap)Mp[18])  // Symbol Pixmap for message dialog
  10.  
  11. class Body : private Timer, public History {
  12. private:
  13.     Widget body;
  14.     unsigned short xsize, ysize;
  15.     Mahjong ***pie;
  16.     Mahjong ***initialp;
  17.     PiePos  *piepos[PKIND];
  18.     unsigned char **pstatus;
  19.         // 0: removed, 1: exist, 2: just clicked
  20.     short rest;   // number of pieces left
  21.     unsigned char pause;  // Game is pausing when pause=1
  22.     unsigned char status;
  23.         // 0: normal, 1: one clicked, 2: pair selected (not cleared yet)
  24.         // 3: no game
  25.     unsigned char gravity;
  26.     unsigned char clearqueue;
  27.     Point clicked_p;  // position of clicked piece when status==1
  28.     Point xp1, xp2;
  29.         // Positions of pieces to be getting
  30.     Point vp1, vp2;
  31.         // Positions to connect line
  32.     Point hint_p1, hint_p2;  // Position of hint
  33.     short hintNum, currentHintNum, initialHintNum;
  34.     Point *hintArray;
  35.     GC  gcl, gcc;
  36.     short xoff, yoff;
  37.     short xstep, ystep;
  38.     short xmarg, ymarg;
  39.     short currentWidth, currentHeight;
  40.     unsigned char demoMode;
  41.     unsigned char helpUsed;
  42.     short timeOut;
  43.     int reset(int);
  44.     void refreshhint(void);
  45.     void getnexthint(void);
  46.     void fallpiece(int);
  47.     void insertpiece(const Point&);
  48.     void removePair(void);
  49.     int can_pass(int, int);
  50.     void get_hrange(int, int, int&, int&);
  51.     void get_vrange(int, int, int&, int&);
  52.     int sweep_horiz(Point, Point, int&);
  53.     int sweep_vert(Point, Point, int&);
  54. public:
  55.     int game;
  56.     Body(int, int, int, Widget, Widget);
  57.     ~Body(void);
  58.     void ChangeGame(int, int, int);
  59.     void SetGC(void);
  60.     void SetGeometry(int, int);
  61.     int  GetGeometry(int&, int&);
  62.     void SetSize(int, int);
  63.     void Sort(void);  // for Opening
  64.     void Sort2(void); // for "Click Trial"
  65.     void Restart(void);
  66.     void Shuffle(void);
  67.     void GetPos(int, int, int&, int&);
  68.     void DrawOne(int, int);
  69.     void DrawCol(int);
  70.     void DrawAll(void);
  71.     void DrawRegion(int, int, int, int);
  72.     void GetPiece(int, int);
  73.     void CancelPiece(int, int);
  74.     void Back(void);
  75.     int GetRest(void);
  76.     int Check(const Point&, const Point&);
  77.     int Active(void);
  78.     void HourlyPatrol(void);
  79.     void LinkLine(void);
  80.     void ClearLine(void);
  81.     void ClearLineAll(void);
  82.     void Hint(void);
  83.     int TogglePause(void);
  84.     void ToggleClickTrial(void);
  85.     void ToggleGravity(void);
  86.     void WriteRcFile(void);
  87.     void LogGiveUp(void);
  88.     void GameOver(void);
  89.     void SetDemo(int);
  90.     void Robot(void);
  91.     operator Widget(){ return body; }
  92. };
  93.  
  94. struct GlobRes {
  95.     char    *aboutString;
  96.     char    *tedumari;
  97.     int     Width;
  98.     int     Height;
  99.     char    *timeFormat;
  100.     char    *displayFormat1;
  101.     char    *displayFormat2;
  102.     char    *scoreFile;
  103.     char    *personalScoreFile;
  104.     Boolean scoreOnly;
  105.     Pixel   connLineColor;
  106.     int     connLineTime;
  107.     int     connLineWidth;
  108.     Boolean autoDemo;
  109.     char    *libDir;
  110.     float   magFactor;
  111.     Boolean fitPixmap;
  112.     int     colorCloseness;
  113.     int     gameSize;
  114.     Boolean trialMode;
  115.     Boolean gravityMode;
  116.     int     idleTime;
  117.     char    *kanjiCode;
  118.     Boolean kanjiConv;
  119. };
  120.  
  121. void MenuAC(Widget, XEvent*, String*, Cardinal*);
  122. void PickupPieceAC(Widget, XEvent*, String*, Cardinal*);
  123. void CancelPieceAC(Widget, XEvent*, String*, Cardinal*);
  124. void PopDownTO(XtPointer, XtIntervalId*);
  125. void ScoreRegisterCB(Widget, int);
  126. void ResizeCB(void);
  127. void AutoDemoCB(void);
  128. void ExitCB(void);
  129. void GetGameSize(int, int&, int&);
  130. void GetBoardSizeFromGameSize(int, int, int&, int&);
  131. void SetGameStart(void);
  132.  
  133. extern Mahjong      Mp[];
  134. extern Body         *bd;
  135. extern Score        *sc;
  136. extern MenuBar      *mb;
  137. extern TimerW       *tm;
  138. extern GlobRes      globRes;
  139. extern Dimension    max_win_wid;
  140. extern Dimension    max_win_hei;
  141. extern char         *rcfile;
  142.